package net.juantxu.pentaho.launcher.utilidades;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;




public class RecreaDirectorioPluginSamples {

	public RecreaDirectorioPluginSamples(String dir){
		//Creating plugin-samples directory 
		System.out.println("Deleting plugin-samples folder under pertaho-solutions");		
		File f =    new File(dir);
		new BorraDirectorio().deleteDirectory(f);
		f.mkdir();
		//Creating index.xml
		 try{
			  // Create file 
			  FileWriter fstream = new FileWriter(dir  + "/index.xml");
			  BufferedWriter out = new BufferedWriter(fstream);
			  out.write("<index><visible>true</visible><name>Plugin Samples</name><description>Plugin Samples</description></index>");
			  //Close the output stream
			  out.close();	  
			  }catch (Exception e){//Catch exception if any
			  System.err.println("Error: " + e.getMessage());
			  }
		
	}
}
